import java.util.concurrent.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-09-10
 * Time: 15:15
 */
public class demo6 {
    /**
     * 使用ThreadPoolExecutor创建一个忽略最新任务的线程池，创建规则：
     * 1.核心线程数为5
     * 2.最大线程数为10
     * 3.任务队列为100
     * 4.拒绝策略为忽略最新任务
     */

    public static void main(String[] args) {
        BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(100);

        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(
                5, 10, 4, TimeUnit.HOURS,
                queue, Executors.defaultThreadFactory(), new ThreadPoolExecutor.DiscardPolicy());

    }
}
